﻿<UserControl x:Class="EyeOpen.Crypt.Silverlight.EncryptionInfo"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    xmlns:BoolConverter="clr-namespace:EyeOpen.UI.Silverlight;assembly=EyeOpen.UI.Silverlight"
    xmlns:Converter="clr-namespace:EyeOpen.Crypt.ViewModel.Silverlight;assembly=EyeOpen.Crypt.ViewModel.Silverlight"
   >
    <UserControl.Resources>
        <Converter:EncryptionTypeConverter x:Key="encryptionToVisibilityConverter" />
        <BoolConverter:BoolToVisibilityConverter x:Key="boolToVisibilityConveter"/>
    </UserControl.Resources>
    <Grid
         DataContext="{Binding Path=CryptViewModel, Source={StaticResource viewModelLocator}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="140"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <StackPanel
            Grid.Column="0" 
            Grid.RowSpan="2">
            <Button
                    Content="Crypt/Decrypt"
                HorizontalAlignment="Left"
                Command="{Binding EncryptDecryptCommand}"
                IsEnabled="{Binding IsEnabled}"
            />
            <TextBlock
                Text="Encryption Type"
             />
        </StackPanel>
        <StackPanel
            Margin="5,0,0,0"
            Grid.Column="1" 
            Grid.RowSpan="2">
            <Button
                HorizontalAlignment="Left"
                Content="Copy to clipboard"
                Command="{Binding CopyToClipboadCommand}"
                IsEnabled="{Binding IsClipboardEnabled}"
            />
            <StackPanel
                Orientation="Horizontal">
                <RadioButton
                    Content="Encrypted compressed"                                                
                    IsChecked="{Binding EncryptionType, ConverterParameter=EncryptedCompressed, Converter={StaticResource encryptionToVisibilityConverter}}"
                    GroupName="Encryption compressed"
                    IsEnabled="False"
                />
                <RadioButton
                    Content="Encrypted not compressed"                                                
                    IsChecked="{Binding EncryptionType, Converter={StaticResource encryptionToVisibilityConverter}, ConverterParameter=EncryptedNotCompressed}"
                    GroupName="Encrypted not compressed"
                    IsEnabled="False">
                </RadioButton>
                <RadioButton
                    Content="Clear text"                                                
                    IsChecked="{Binding EncryptionType, Converter={StaticResource encryptionToVisibilityConverter}, ConverterParameter=Decrypted}"
                    GroupName="Clear text"
                    IsEnabled="False">
                </RadioButton>
            </StackPanel>
        </StackPanel>
        <Grid
            Visibility="{Binding EncryptInfoIsAvailable, Converter={StaticResource boolToVisibilityConveter}}"
            Grid.Row="2"
            Grid.ColumnSpan="2">
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="140" />
                <ColumnDefinition Width="50"/>
            </Grid.ColumnDefinitions>
            <StackPanel
                Grid.Column="0"
                Grid.RowSpan="3">
                <TextBlock Text="Clear Text Lenght" />
                <TextBlock Text="Encrypted Text Lenght" />
                <TextBlock Text="Compressed Text Lenght" />
            </StackPanel>
            <StackPanel
                Margin="8,0,0,0"
                Grid.Column="1"
                Grid.RowSpan="3">
                <TextBlock Text="{Binding ClearTextLenght}" />
                <TextBlock Text="{Binding EncryptedTextLenght}" />
                <TextBlock Text="{Binding CompressedTextLenght}"/>
            </StackPanel>
        </Grid>
    </Grid>
</UserControl>